package com.bsoft.gol.hcs.specialist.dao;

/**
 * @Author:FangZhiyi
 * @Description
 * @Data Created in 2020/7/15 9:49
 * @Moddified By:
 */

import ctd.persistence.annotation.DAOMethod;
import ctd.persistence.annotation.DAOParam;
import ctd.persistence.support.hibernate.HibernateSupportDelegateDAO;
import com.bsoft.gol.hcs.specialist.entity.FollowUpRouteDetailFactor;

import java.util.List;

public abstract class FollowUpRouteDetailFactorDAO extends HibernateSupportDelegateDAO<FollowUpRouteDetailFactor> {

	@DAOMethod(sql = " from  FollowUpRouteDetailFactor where organization_id=:orgId and route_id =:routeId and " +
			"route_detail_id=:routeDetailId and factor_flag=:factorFlag")
	public abstract List<FollowUpRouteDetailFactor> queryFactorListByFactorFlag(@DAOParam("orgId") String organizationId, @DAOParam("routeId") Long routeId, @DAOParam("routeDetailId") long routeDetailId, @DAOParam("factorFlag") Byte factorFlag);

	@DAOMethod(sql = " from  FollowUpRouteDetailFactor where organization_id=:orgId and route_id =:routeId and " +
			"route_detail_id=:routeDetailId ")
	public abstract List<FollowUpRouteDetailFactor> queryFactorList(@DAOParam("orgId") String organizationId,
																	@DAOParam("routeId") Long routeId, @DAOParam(
			"routeDetailId") long routeDetailId);

	@DAOMethod(sql = "DELETE from FollowUpRouteDetailFactor where route_detail_id =:routeDetailId and " +
			"factor_flag=:factorFlag")
	public abstract void deleteContentByFactorDetailId(@DAOParam("routeDetailId") Long routeDetailId, @DAOParam(
			"factorFlag") Byte factorFlag);

	@DAOMethod(sql = " from  FollowUpRouteDetailFactor where routeDetailId =:routeDetailId and factorFlag = " +
			":factorFlag ")
	public abstract List<FollowUpRouteDetailFactor> queryByRouteDetailId(@DAOParam("routeDetailId") Long routeDetailId
			, @DAOParam("factorFlag") Byte factorFlag);

	@DAOMethod(sql = "DELETE from FollowUpRouteDetailFactor where route_detail_id =:routeDetailId")
	public abstract void removeFactorByDetailId(@DAOParam("routeDetailId") Long routeDetailId);

	@DAOMethod(sql = " from  FollowUpRouteDetailFactor where organization_id=:orgId and factor_flag=:factorFlag and factor_parentId=:factorId order by gmt_create desc")
	public abstract List<FollowUpRouteDetailFactor> queryFactorByFactorFlag(@DAOParam("orgId") String organizationId, @DAOParam("factorFlag") Byte factorFlag,@DAOParam("factorId") String factorId);


}
